import request from "@/utils/request";
import type { DeviceInfo, DeviceThreshold } from "./type";

export const getDeviceInfoList = () => {
    return request.get("/device/info/list");
}

export const registerDevice = (deviceInfo: DeviceInfo) => {
    return request.post("/device/info/register", deviceInfo);
}

export const removeDevice = (id: string) => {
    return request.post("/device/info/remove/"+id);
}

export const getDeviceLogListByDeviceId = (deviceId: string) => {
    return request.get("/device/log/list", {
        params: {
            "deviceId": deviceId
        }
    });
}


export const getDeviceLogList = () => {
    return request.get("/device/log/list");
}

export const getDeviceThresholdList = () => {
    return request.get("/device/threshold/list");
}

export const createDeviceThreshold = (data: DeviceThreshold) => {
    return request.post("/device/threshold/create", data)
}

export const removeDevicethreshold = (id: string) => {
    return request.delete("/deivce/threshold/delete", {
        params: {
            'id': id
        }
    })
}

export const editDeviceThreshold = (data: DeviceThreshold) => {
    return request.put("/device/threshold/edit", data)
}